<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href='__PUBLIC__/bs/css/bootstrap.min.css'>
	<link rel="stylesheet" href='../Public/css/index.css'>
	<script src="__PUBLIC__/bs/js/jquery.js"></script>
	<script src="__PUBLIC__/bs/js/bootstrap.min.js"></script>
	<script src="../Public/js/index.js"></script>
</head>
<body>
	<div class="container">
		<div class="admin">
			<div class="header">
				<h1>后台管理系统</h1>
				<ul class="list-inline">
					<li><a href="">首页</a></li>
					<li><a href="">退出</a></li>
					<li><a href="">帮助</a></li>
				</ul>
			</div>
			<div class="row">
				<div class="left col-md-3">
					<div class="list-group User">
					  <a href="javascript:" class="list-group-item active">
					    用户管理
					  </a>
					  <a href="<?php echo U('User/index');?>" class="list-group-item">查看用户</a>
					  <a href="<?php echo U('User/add');?>" class="list-group-item">添加用户</a>
					</div>
					<div class="list-group Class">
					  <a href="javascript:" class="list-group-item active">
					    分类管理
					  </a>
					  <a href="<?php echo U('Class/index');?>" class="list-group-item">查看分类</a>
					  <a href="<?php echo U('Class/add');?>" class="list-group-item">添加分类</a>
					</div>
					<div class="list-group Brand">
					  <a href="javascript:" class="list-group-item active">
					    品牌管理
					  </a>
					  <a href="<?php echo U('Brand/index');?>" class="list-group-item">查看品牌</a>
					  <a href="<?php echo U('Brand/add');?>" class="list-group-item">添加品牌</a>
					</div>
					<div class="list-group Shop">
					  <a href="javascript:" class="list-group-item active">
					    商品管理
					  </a>
					  <a href="<?php echo U('Shop/index');?>" class="list-group-item">查看商品</a>
					  <a href="<?php echo U('Shop/add');?>" class="list-group-item">添加商品</a>
					</div>
					<div class="list-group Comment">
					  <a href="javascript:" class="list-group-item active">
					    评论管理
					  </a>
					  <a href="<?php echo U('Comment/index');?>" class="list-group-item">查看评论</a>
					</div>
					<div class="list-group Indent" >
					  <a href="javascript:" class="list-group-item active">
					    订单管理
					  </a>
					  <a href="<?php echo U('Indent/index');?>" class="list-group-item">查看订单</a>
					</div>
					<div class="list-group Status" >
					  <a href="javascript:" class="list-group-item active">
					    订单状态
					  </a>
					  <a href="<?php echo U('Status/index');?>" class="list-group-item">查看订单状态</a>
					  <a href="<?php echo U('Status/add');?>" class="list-group-item">添加订单状态</a>
					</div>
					<div class="list-group Advert" >
					  <a href="javascript:" class="list-group-item active">
					    广告管理
					  </a>
					  <a href="<?php echo U('Advert/index');?>" class="list-group-item">查看广告</a>
					  <a href="<?php echo U('Advert/add');?>" class="list-group-item">添加广告</a>
					</div>
					<div class="list-group System" >
					  <a href="javascript:" class="list-group-item active">
					    系统管理
					  </a>
					  <a href="<?php echo U('System/index');?>" class="list-group-item">修改密码</a>
					</div>
				</div>
				
	<div class="right col-md-9">
		<form class="col-sm-7 form-horizontal" action="<?php echo U('add_handle');?>" method="post" enctype="multipart/form-data">
		  <div class="form-group">
		    <label class="col-sm-4 control-label">商品名称</label>
		    <div class="col-sm-5">
		      <input type="text" class="form-control " name="name" value="">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-4 control-label">商品价格</label>
		    <div class="col-sm-3">
		      <input type="text" class="form-control " name="price">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-4 control-label">库存</label>
		    <div class="col-sm-3">
		      <input type="text" class="form-control " name="stock">
		    </div>
		  </div>
		 <div class="form-group">
		   <label class="col-sm-4 control-label">是否上架</label>
		   <div class="col-sm-3">
		   		<input type="radio" checked name='shelf' value='1'>上架
		   		<input type="radio" name='shelf' value='0'>下架
		   </div>
		 </div>
		 <div class="form-group">
		   <label class="col-sm-4 control-label">品牌分类</label>
		   <div class="col-sm-3">
		     <select class="form-control" name="class_brand" id="">
		     	<?php if(is_array($classrows)): $i = 0; $__LIST__ = $classrows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$classrow): $mod = ($i % 2 );++$i;?><!-- 循环分类 -->
		     		<option value="<?php echo ($classrow['id']); ?>" disabled><?php echo ($classrow['name']); ?></option><!-- 分类加disabled变成不可选 -->
		     		<?php if(is_array($brandrows)): $i = 0; $__LIST__ = $brandrows;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$brandrow): $mod = ($i % 2 );++$i; if($brandrow['class_id'] == $classrow['id']): ?><!-- 如果品牌表的class_id等于分类表里的id显示同一分类下的品牌 -->
		     				<option value="<?php echo ($classrow['id']); ?>-<?php echo ($brandrow['id']); ?>">|--<?php echo ($brandrow['name']); ?></option> <!-- value值显示class_id-brand_id  php拆分获得分类id，品牌id--><?php endif; endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
		     </select>
		   </div>
		 </div>
		 <div class="form-group">
		   <label class="col-sm-4 control-label">上传图片</label>
		   <div class="col-sm-3">
		     <input type="file"  name="img">
		   </div>
		 </div>
		  <div class="form-group">
		    <div class="col-sm-offset-2 col-sm-10">
		      <button type="submit" class="btn btn-primary">添加</button>
		      <button type="reset" class="btn btn-danger">取消</button>
		    </div>
		  </div>
		</form>
	</div>

			</div>
		</div>
	</div>
	
</body>
<script>
$(function(){
	/////////////首页////////////
	// 根据模块名使对应下拉列表显示
	cls="<?php echo get_url_module();?>";//获取模块名方法，Admin\common\common.php中自定义方法
	$('.'+cls).children().show();
	///////////首页结束//////////
	
	// 删除
	$('.del').click(function(){
		id=$(this).attr('idx');
		obj=$(this);
		$.get("<?php echo U('delete');?>",{'id':id},function(r){
			// 状态是1证明数据成功，显示删除成功，隐藏相应数据
			if(r.status==1){
				alert(r.info);
				obj.parent().parent().hide(200);
			}else{
				// 弹出管理员不可删除
				alert(r.info);
			}
		},'json');
	})


	
})
</script>
</html>